import 'dio_service.dart';

class DioServiceManager {
  static final DioServiceManager _instance = DioServiceManager._internal();
  factory DioServiceManager() {
    return _instance;
  }

  DioServiceManager._internal() {
    init();
  }

  void init() {}

  Map serviceMap = {};

  void registeredService(DioService service) {
    service.initDio();
    String key = service.serviceKey();
    serviceMap[key] = service;
  }

  DioService getService(String serviceKey) {
    if (serviceMap.containsKey(serviceKey)) {
      return serviceMap[serviceKey];
    }
    throw Exception('服务尚未注册');
  }

}